<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>二维码</title>
    <style>
        * {
            padding: 0;
        }

        div {
            margin: 0 auto;
            position: relative;
            width: 300px;
            height: 400px;
            text-align: center;
            border: 1px solid black;
        }

        img {
            width: 300px;
            height: 380px;
        }

        .i {
            position: absolute;
            top: -1px;
            right: -1px;
            line-height: 10px;
            font-size: 13px;
            text-align: center;
            width: 12px;
            height: 12px;
            border: 1px solid black;
            /* 鼠标移动到上面变样式 */
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div>
        <span>二维码</span>
        <img src="/跟着狂神/img/二维码.jpg" alt="">
        <i class="i">x</i>
    </div>
</body>
      
      <script>
        var div=document.querySelector('div')
        // var img=document.querySelector('img')
        var btn=document.querySelector('.i')
        btn.onclick=function(){
            div.style.display='none'//隐藏盒子
        }
      </script>
</html>